package com.mate.cloud.ops;

import com.mate.cloud.entity.City;
import com.mate.cloud.mapper.CityMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

@Slf4j
@CacheConfig(cacheNames = "city")
public class SpringCacheOps {

    @Autowired
    private CityMapper cityMapper;

    @Cacheable
    public City getCity(String code){
        return cityMapper.getCity(code);
    }
}